import java.sql.*;

public class TestDML {
	public static void main(String[] args) {
		Statement sta = null;
		Connection conn = null;
		try{
			Class.forName("oracle.jdbc.driver.OracleDriver");
			conn = DriverManager.getConnection("jdbc:oracle:thin:@127.0.0.1:1521:lovemanai", "scott", "tiger");
			sta = conn.createStatement();
			String sql = "insert into dept2 values (99, 'GAME', 'manai')";
			sta.executeUpdate(sql);
		} catch(ClassNotFoundException e) {
			System.out.println("没有找到相应驱动");
		} catch(SQLException e) {
			e.printStackTrace();
		} finally {
			try {
				if(sta != null) {
					sta.close();
					sta = null;
				}
				if(conn != null) {
					conn.close();
					conn = null;
				}
			} catch(SQLException e) {
				e.printStackTrace();
			}
			
		}
	}
}
